<?php

/**
 * helper
 * 
 * @author
 * @version 
 */
namespace Application\View\Helper;

use Zend\View\Helper\AbstractHelper;

/**
 * View Helper
 */
class DateViewHelper extends AbstractHelper {
	public function __invoke( $dateDebutFormater, $dateFinFormater ) {

		$monthArray = array('Janv.', 'Févr.', 'Mars', 'Avr.', 'Mai', 'Juin', 'Juil.', 'Août', 'Sept.', 'Oct.', 'Nov.', 'Dec.' );

		$aDateD = explode("-", $dateDebutFormater);

		$aDateF = explode("-", $dateFinFormater);		

		$moisD = intval($aDateD[1]) - 1;
		$moisF = intval($aDateF[1]) - 1;

		if( $moisD === $moisF && $aDateD[0] == $aDateF[0] ) {
			return "Du " . $aDateD[2] . " au " . $aDateF[2] . " " . $monthArray[$moisD];
		} else if( $moisD !== $moisF && $aDateD[0] == $aDateF[0] ) {
			return "Du " . $aDateD[2] . " " . $monthArray[$moisD] . " au " . $aDateF[2] . " " . $monthArray[$moisF];		
		} else {
			return "Du " . $aDateD[2] . " " . $monthArray[$moisD] . " " . $aDateD[0] ." au " . $aDateF[2] . " " . $monthArray[$moisF] . " " . $aDateF[0];		
		}
	}
}
